package controllers;

import play.*;
import play.mvc.*;
import utils.Constants;
import utils.Secure;

import java.util.*;

import models.*;

public class Application extends Controller {
	
	@Before
	public static void checkLogin(){
		Secure secure = getActionAnnotation(Secure.class);
		//如果没有注解或者注解需要登录均需验证登录状态
		if(secure == null || secure.login() == true){
			if(session.get(Constants.USERNAME_IN_SESSION)==null){
				Users.login();
			}
		}
	}
	
	@Before
	public static void checkSecure(){
		
	}
	
	@Secure(login=false)
    public static void index() {
        render();
    }

}